<!---
Copyright: (c) 2006 The MachBlog Authors
Authors: Matt Woodward (mpwoodward@gmail.com) & Peter J. Farrell (pjf@maestropublishing.com)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. 
You may obtain a copy of the License at 

http://www.apache.org/licenses/LICENSE-2.0 

Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an "AS IS" BASIS, 
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
See the License for the specific language governing permissions and 
limitations under the License.

$Id: TrackbackGateway.cfc 1191 2007-07-14 17:42:46Z pfarrell $

Notes:
--->
<cfcomponent
	displayname="TrackbackGateway"
	output="false"
	hint="TrackbackGateway for MachBlog">

	<!---
	PROPERTIES
	--->
	<cfproperty name="datasource" type="org.machblog.datasource.Datasource" required="true" />
	<cfproperty name="resourceBundleFacade" type="org.machblog.facades.ResourceBundleFacade" required="true" />
	
	<!---
	INITIALIZATION / CONFIGURATION
	--->
	<cffunction name="init" access="public" output="false" returntype="TrackbackGateway">
		<cfreturn this />
	</cffunction>

	<cffunction name="setDatasource" access="public" output="false" returntype="void"
		hint="Dependency: injected">
		<cfargument name="datasource" type="org.machblog.datasource.Datasource" required="true" />
		<cfset variables.datasource = arguments.datasource />
	</cffunction>
	<cffunction name="getDatasource" access="public" output="false" 
			returntype="org.machblog.datasource.Datasource">
		<cfreturn variables.datasource />
	</cffunction>

	<cffunction name="setResourceBundleFacade" access="public" output="false" returntype="void"
		hint="Dependency: injected">
		<cfargument name="resourceBundleFacade" type="org.machblog.facades.ResourceBundleFacade" required="true" />
		<cfset variables.resourceBundleFacade = arguments.resourceBundleFacade />
	</cffunction>
	<cffunction name="getResourceBundleFacade" access="public" output="false" returntype="org.machblog.facades.ResourceBundleFacade">
		<cfreturn variables.resourceBundleFacade />
	</cffunction>

	<!---
	PUBLIC FUNCTIONS
	--->	
	<cffunction name="getTrackbacks" access="public" output="false" returntype="query" 
		hint="Returns a query containing all the trackbacks for a particular entry">
		<cfargument name="entryId" type="string" required="true" />
		<cfargument name="getAll" type="boolean" required="false" default="false" />
	</cffunction>
	
	<cffunction name="getRecentTrackbacks" access="public" output="false" returntype="query" 
		hint="Returns a query containing recent trackbacks across all entries">
		<cfargument name="numToGet" type="numeric" required="true" />
		<cfargument name="includeInactive" type="boolean" required="false" default="false" />
	</cffunction>
	
	<cffunction name="getTrackbackCountByDate" access="public" output="false" returntype="numeric" 
		hint="Returns the number of trackbacks added on a particular date">
		<cfargument name="trackbackDate" type="date" required="true" />
	</cffunction>

	<cffunction name="deactivateTrackbacksByEntryId" access="public" output="false" returntype="void" 
		hint="Deactivates all trackbacks for a particular entry">
		<cfargument name="entryId" type="uuid" required="true" />
	</cffunction>
	
	<cffunction name="activateTrackbacksByEntryId" access="public" output="false" returntype="void" 
		hint="Activates all trackbacks for a particular entry">
		<cfargument name="entryId" type="uuid" required="true" />
	</cffunction>
	
	<cffunction name="deleteTrackbacksByEntryId" access="public" output="false" returntype="void" 
		hint="Deletes all trackbacks associated with a particular entry">
		<cfargument name="entryId" type="uuid" required="true" />
	</cffunction>
	
	<cffunction name="toggleTrackbackDisplay" access="public" output="false" returntype="void" 
		hint="Approves or unapproves a trackback">
		<cfargument name="trackbackId" type="uuid" required="true" />
		<cfargument name="action" type="string" required="true" />
		<cfargument name="adminId" type="uuid" required="true" />
	</cffunction>
	
	<cffunction name="deleteTrackbacks" access="public" output="false" returntype="void" 
		hint="Deletes trackbacks">
		<cfargument name="deleteIds" type="string" required="true" />
	</cffunction>

</cfcomponent>